<?php
class Administration_Form_Games extends Jnd_Form
{
    protected $_teams = array();
    protected $_locations = array();

    public function __construct( $params = array(), $decorateur = "Formulairejnd", $options = null )
    {
        $this->_teams = isset($params['teams']) ? $params['teams'] : array();
        $this->_locations = isset($params['locations']) ? $params['locations'] : array();
        parent::__construct($decorateur, $options);
        $this->setElementDecorators(array(
            "$decorateur"
        ), array(
            'pictures'
        ), false);
    }

    public function init()
    {
        
        //
        // Field id
        $field = new Zend_Form_Element_Text("id");
        $field->setLabel('Id');
        $field->setAttribs(array(
            'readonly' => 'readonly', 
            'class' => 'readonly'
        ));
        $field->setFilters(array(
            'Digits'
        ));
        $fields[] = $field;
        
        //
        //	Field team home
        $field = new Zend_Form_Element_Select("idTeamHome");
        $field->setLabel(__('Home'));
        $field->setMultiOptions($this->_teams);
        $field->setRequired(true);
        $fields[] = $field;
        
        //
        //	Field team visitor
        $field = new Zend_Form_Element_Select("idTeamVisitor");
        $field->setLabel(__('Visitor'));
        $field->setMultiOptions($this->_teams);
        $field->setRequired(true);
        $fields[] = $field;
        
        //
        //	Field location
        $field = new Zend_Form_Element_Select("idLocation");
        $field->setLabel(__('Location'));
        $field->setMultiOptions($this->_locations);
        $field->setRequired(true);
        $fields[] = $field;
        
        //
        //	Field date
        $field = new Jnd_Form_Element_TimePicker("date");
        $field->setLabel(__('Date'));
        $fields[] = $field;
        
        //
        //  Field score home first
        $field = new Zend_Form_Element_Text("scoreHomeFirst");
        $field->setLabel(_('Home First'));
        $field->setValue(0);
        $fields[] = $field;
        
        //
        //  Field score home visitor
        $field = new Zend_Form_Element_Text("scoreVisitorFirst");
        $field->setLabel(_('Visitor First'));
        $field->setValue(0);
        $fields[] = $field;
        
        //
        //  Field score home second
        $field = new Zend_Form_Element_Text("scoreHomeSecond");
        $field->setLabel(_('Home Second'));
        $field->setValue(0);
        $fields[] = $field;
        
        //
        //  Field score visitor second
        $field = new Zend_Form_Element_Text("scoreVisitorSecond");
        $field->setLabel(_('Visitor Second'));
        $field->setValue(0);
        $fields[] = $field;
        
        //
        //  Field score home third
        $field = new Zend_Form_Element_Text("scoreHomeThird");
        $field->setLabel(_('Home Third'));
        $field->setValue(0);
        $fields[] = $field;
        
        //
        //  Field score visitor third
        $field = new Zend_Form_Element_Text("scoreVisitorThird");
        $field->setLabel(_('Visitor Third'));
        $field->setValue(0);
        $fields[] = $field;
        
        //
        //  Field score home overtime
        $field = new Zend_Form_Element_Text("scoreHomeOvertime");
        $field->setLabel(_('Home Overtime'));
        $field->setValue(0);
        $fields[] = $field;
        
        //
        //  Field score visitor overtime
        $field = new Zend_Form_Element_Text("scoreVisitorOvertime");
        $field->setLabel(_('Visitor Overtime'));
        $field->setValue(0);
        $fields[] = $field;
        
        //
        //  Field score home shoutout
        $field = new Zend_Form_Element_Text("scoreHomeShoutout");
        $field->setLabel(_('Home Shoutout'));
        $field->setValue(0);
        $fields[] = $field;
        
        //
        //  Field score visitor shoutout
        $field = new Zend_Form_Element_Text("scoreVisitorShoutout");
        $field->setLabel(_('Visitor Shoutout'));
        $field->setValue(0);
        $fields[] = $field;
        
        //
        //  Field creationUser
        $storage = (object) Zend_Auth::getInstance()->getStorage()->read();
        $field = new Zend_Form_Element_Text("creationUser");
        $field->setLabel(_('Created by'));
        $field->setValue($storage->username);
        $field->setAttribs(array(
            "readonly" => "readonly", 
            "class" => "readonly"
        ));
        $fields[] = $field;
        
        //
        //	Field crationDate
        $field = new Zend_Form_Element_Text("creationDate");
        $field->setLabel(__('Created'));
        $field->setAttribs(array(
            "readonly" => "readonly", 
            "class" => "readonly"
        ));
        $field->setValue(date(Jnd_Global_Constantes::FORMAT_DATE_WEB_LONG));
        $fields[] = $field;
        
        $this->addElements($fields);
        
        $this->setName("gamse");
    }

}